﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Iacym.Entities;

namespace Iacym.Repository.Mapping
{
    public class UBIGEOMap : EntityTypeConfiguration<UBIGEO>
    {
        public UBIGEOMap()
        {
            this.HasKey(t => t.numero);

            this.Property(t => t.numero)
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Departamento)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Provincia)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Distrito)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.IdUbigeo)
                .IsRequired()
                .HasMaxLength(6);


            this.ToTable("UBIGEO");
            this.Property(t => t.IdUbigeo).HasColumnName("IdUbigeo");
            this.Property(t => t.Departamento).HasColumnName("Departamento").HasColumnType("varchar");
            this.Property(t => t.Provincia).HasColumnName("Provincia").HasColumnType("varchar");
            this.Property(t => t.Distrito).HasColumnName("Distrito").HasColumnType("varchar");
        }
    }
}
